<!DOCTYPE html>
<!--
Copyright 2012 The Polymer Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<html>
  <head>
    <title></title>
    <script src="lib/loader.js"></script>
    <style>
      div, g-A, g-B {
        display: block;
        border: 1px dotted red;
        margin: 8px;
        padding: 8px;
      }
    </style>
    <script>
      change = function() {
        A = $("g-A");
        A.webkitCreateShadowRoot().appendChild($("template#Ab").content);
        A.webkitCreateShadowRoot().appendChild($("template#A").content);
        //
        B = A.webkitShadowRoot.querySelector("g-B");
        B.webkitCreateShadowRoot().appendChild($("template#Bb").content);
        B.webkitCreateShadowRoot().appendChild($("template#B").content);
      }
    </script>
  </head>
  <body onload="change()">
      <g-A><span id="a1">Where am I?</span></g-A>

      <!-- content inserts into this shadow -->
      <template id="Ab">[Ab->]<content></content>[<-Ab]</template>
      <!-- content must project through shadow-content to become B content -->
      <template id="A">[A->]<g-B><shadow></shadow></g-B>[<-A]</template>
      <!-- simply echo content -->
      <template id="Bb">[Bb->]<content></content>[<-Bb]</template>
      <!-- content must project through shadow-content to become B content -->
      <template id="B">[B->]<shadow></shadow>[<-B]</template>
      <hr/>

      Expected output (also, see console):

      <div>[A-&gt;]<div>[B-&gt;][Bb-&gt;][Ab-&gt;]<span id="a1">Where am I?</span>[&lt;-Ab][&lt;-Bb][&lt;-B]</div>[&lt;-A]</div>
</body>
</html>
